﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace BulldogCMS.Data.Security
{
    public class XMLPartialGroupNode : IPartialGroupNode
    {
        private XElement _element = null;
        private List<Guid> _members = new List<Guid>();

        public XMLPartialGroupNode(XElement element)
        {
            this._element = element;
            this.Name = this._element.GetAttributeValue<string>("name");
            this.ID =   this._element.GetAttributeValue<Guid>("ID");

            if (this._element.Element("users") != null)
            {
                foreach (XElement userEl in this._element.Element("users").Elements())
                {
                    _members.Add(userEl.GetAttributeValue<Guid>("withID"));
                }
            }
        }

        public string Name
        {
            get;
            private set;
        }

        public Guid ID
        {
            get;
            private set;
        }

    }
}
